<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var minCostClimbingStairs = function (cost) {
        let dp = new Array(cost.length + 1).fill(0)
        for (let i = 2; i < dp.length; i++) {
          dp[i] = Math.min(dp[i - 1] + cost[i - 1], dp[i - 2] + cost[i - 2])
        }
        return dp[dp.length - 1]
      }
    </script>
  </body>
</html>
